<?php


namespace app\admin\controller;


use app\common\controller\AdminBase;

class Integral extends AdminBase
{

    public function index(){
        $user_list = cache('userlist');
        $this->assign('user_list',$user_list);
        return $this->fetch();
    }

    public function getlists(){
        $m = new \app\common\model\User();
        return $m->get_list();
    }

    public function edit(){
        return $this->fetch();
    }

    public function save(){
        $integral = input('integral');
        $user_id = input('user_id');
        $user = new \app\common\model\User();
        $res = $user->put_integral(7,$integral,'',$user_id);
        if($res){
            return ajax_return(1,'修改成功','index');
        } else{
            return ajax_return(0,'修改失败');
        }
    }

    public function update_in(){
        $user_id = input('ids/a');
        $inte = input('inte');
        $user = new \app\common\model\User();
        foreach ($user_id as $v){
            $res[] = $user->put_integral(7,$inte,'',$v);
        }
        if($res){
            return ajax_return(1,'修改成功','index');
        } else{
            return ajax_return(0,'修改失败');
        }
    }

}